package com.hoopchina.service;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;




public class NewsService  {

	private static ExecutorService mCached;
	private static ExecutorService mFixed;
	private static final int THREAD_COUNT = 3;

	/*
	 * 返回cached线程池
	 */
	public static synchronized ExecutorService getTheadPool(boolean isCached) {
		if (isCached) {
			if (mCached == null) {
				mCached = Executors.newCachedThreadPool();
			}
			return mCached;
		} else {
			if (mFixed == null) {
				mFixed = Executors.newFixedThreadPool(THREAD_COUNT);
			}
			return mFixed;
		}

	}
	

}
